{% extends "base.html" %}

{% block title %}
    {{ object.title }}
{% endblock %}

{% block content %}
    {% with subject=object.subject %}
        <h1>{{ object.title }}</h1>
        <div class="module">
            <h2>课程介绍</h2>
            <p>
                <a href="{% url 'course_list_subject' subject.slug %}">{{ subject.title }}</a>.
                {{ object.modules.count }} 个章节.
                老师：{{ object.owner.username }}.
            </p>
            {{ object.overview|linebreaks }}
            {% if request.user.is_authenticated %}
                <form action="{% url 'student_enroll_course' %}" method="post">
                    {{ enroll_form }}
                    {% csrf_token %}
                    <input type="submit" value="选择加入" class="button">
                </form>
            {% else %}
                <a href="{% url 'login' %}" class="button">登陆</a>
                <a href="{% url 'student_register' %}" class="button">注册</a>
            {% endif %}
        </div>
    {% endwith %}
{% endblock %}